function enableCaptcha(n) {
    var t = $(".btn-retransmit"),
    u = $(".txt-phone").val().length,
    i = $(".txt-phone").val(),
    r = "/Home/CheckAgentNotExist";
    n == "1" && (r = "/Home/CheckAgentExist");
    u && !t.hasClass("is-restransit") && checkPhone(i) ? $.ajax({
        url: r,
        type: "POST",
        data: {
            LoginName: i
        },
        dataType: "json",
        success: function(n) {
            if (n == !0) t.removeClass("btn-retransmit-disabled");
            else return
        },
        error: function() {
			t.removeClass("btn-retransmit-disabled");
            //alert("服务器开小差，请稍后重试");
            return
        }
    }) : t.addClass("btn-retransmit-disabled")
}
function doSendSmsCaptcha() {
    var n = $(".txt-phone").val(),
    t = $(".hidden-anti").val(),
    i = {
        mobile: n,
        anti: t
    };
    checkPhone(n) && $.ajax({
        url: "/Home/SendSmsCaptcha",
        type: "POST",
        data: i,
        dataType: "json",
        success: function(n) {
            var t, i, r;
            if (n.ErrorCode == 0) errTips("", "err_LoginName"),
            t = $(".btn-retransmit"),
            t.html("重新发送（60s）").addClass("btn-retransmit-disabled").addClass("is-restransit"),
            i = 60,
            r = setInterval(function() {--i;
                i == 0 ? (t.html("获取短信验证码").removeClass("btn-retransmit-disabled").removeClass("is-restransit"), clearInterval(r)) : t.html("重新发送（" + i + "s）")
            },
            1e3);
            else {
                errTips(n.ErrorMessage, "err_LoginName");
                $(".txt-phone").addClass("input-validation-error");
                return
            }
        },
        error: function() {
            errTips("服务器开小差，请稍后重试");
            return
        }
    })
}
$(function() {
    $(".txt-phone").on("input",
    function() {
        var n = $(this).data("chectype");
        enableCaptcha(n)
    });
    $(".btn-retransmit").on("click",
    function() {
        $(this).hasClass("btn-retransmit-disabled") || $(this).hasClass("is-restransit") || ($(this).addClass("btn-retransmit-disabled"), doSendSmsCaptcha())
    })
})